package com.belf.console.service.impl;

import com.belf.common.utils.DateUtils;
import com.belf.console.domain.DataSyncConf;
import com.belf.console.mapper.DataSyncConfMapper;
import com.belf.console.service.IDataSyncConfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * cdc 配置Service业务层处理
 * 
 * @author belf
 * @date 2024-07-19
 */
@Service
public class DataSyncConfServiceImpl implements IDataSyncConfService 
{
    @Autowired
    private DataSyncConfMapper dataSyncConfMapper;

    /**
     * 查询cdc 配置
     * 
     * @param id cdc 配置主键
     * @return cdc 配置
     */
    @Override
    public DataSyncConf selectDataSyncConfById(Long id)
    {
        return dataSyncConfMapper.selectDataSyncConfById(id);
    }

    /**
     * 查询cdc 配置列表
     * 
     * @param dataSyncConf cdc 配置
     * @return cdc 配置
     */
    @Override
    public List<DataSyncConf> selectDataSyncConfList(DataSyncConf dataSyncConf)
    {
        return dataSyncConfMapper.selectDataSyncConfList(dataSyncConf);
    }

    @Override
    public long selectDataCount(DataSyncConf dataSyncConf) {

        return dataSyncConfMapper.selectDataCount(dataSyncConf);
    }

    /**
     * 新增cdc 配置
     * 
     * @param dataSyncConf cdc 配置
     * @return 结果
     */
    @Override
    public int insertDataSyncConf(DataSyncConf dataSyncConf)
    {
        dataSyncConf.setCreateTime(DateUtils.getNowDate());
        return dataSyncConfMapper.insertDataSyncConf(dataSyncConf);
    }

    /**
     * 修改cdc 配置
     * 
     * @param dataSyncConf cdc 配置
     * @return 结果
     */
    @Override
    public int updateDataSyncConf(DataSyncConf dataSyncConf)
    {
        dataSyncConf.setUpdateTime(DateUtils.getNowDate());
        return dataSyncConfMapper.updateDataSyncConf(dataSyncConf);
    }

    /**
     * 批量删除cdc 配置
     * 
     * @param ids 需要删除的cdc 配置主键
     * @return 结果
     */
    @Override
    public int deleteDataSyncConfByIds(Long[] ids)
    {
        return dataSyncConfMapper.deleteDataSyncConfByIds(ids);
    }

    /**
     * 删除cdc 配置信息
     * 
     * @param id cdc 配置主键
     * @return 结果
     */
    @Override
    public int deleteDataSyncConfById(Long id)
    {
        return dataSyncConfMapper.deleteDataSyncConfById(id);
    }
}
